<!DOCTYPE html>
<html>
	<head> 
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>充值</title>
		<link rel="stylesheet" href="__TMPL__Public/css/ui.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/normalize.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/main.css" />
		<link rel="stylesheet" href="__TMPL__Public/css/style.css" />
	</head>
	<body>
		<!--<div class="header">
			<a onclick="goBack()" class="left-arrow"><img src="__TMPL__Public/img/arrow-b.png"></a>
			充值
		</div>-->
		
		<div class="recharge">
			<div class="re-l">
				<div class="">充值</div>
				<span class="">1金钱=1RMB</span>
			</div>
			<div class="re-c"><div id="nowmny"><span id="nm">1</span><span class="unit">/金钱</span></div>
			<input style="display: none;" type="" name="" id="mny" value="" placeholder="请输入" />
			</div>
			<div class="re-r"><button onclick="chagnemny(this)">修改</button></div>
		</div>
		<div class="linebg mt10">
			<a  class="line-i ebb">
				<img class="line-icon" src="__TMPL__Public/img/user/phone.png">
				<span class="line-before more-w">需支付</span>
				<span class="line-arrow warn-f">￥<span id="isneed">1</span></span>
			</a>
			<a  class="line-i">
				<img class="line-icon" src="__TMPL__Public/img/alipay.png">
				<span class="line-before more-w">支付宝</span>
				<span class="line-arrow">
					<label class="ui-checkbox-s">
					    <input id="ali" class="paytype" type="radio" name="paytype" checked="checked">
					</label>
				</span>
			</a>
			<!--<a  class="line-i">
				<img class="line-icon" src="__TMPL__Public/img/wxpay.png">
				<span class="line-before more-w">微信</span>
				<span class="line-arrow">
					<label class="ui-checkbox-s">
					    <input id="wchat" class="paytype" type="radio" name="paytype">
					</label>
				</span>
			</a>-->
		</div>
		<div class="btmbox mt30">
			<button onclick="gopay()" class="prim-bg">立即支付</button>
		</div>
		
		<div class="footerbody"></div>
	</body>
	<script src="__TMPL__Public/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="__TMPL__Public/js/main.js?{$version}"></script>
	<script type="text/javascript">
	var mny = $("#mny");
	var nowmny = $("#nowmny");
	var nm = $("#nm");
	var tmpmny="0";
		function chagnemny(obj){
			var o = $(obj);
			if(o.text()=="修改"){
				mny.show();
				nowmny.hide();
				o.text("确定");
			}else{
				if(isNaN(mny.val())){
					alert("输入的格式不正确");
					return;
				}else if(mny.val()<=0||mny.val().length==0){
					alert("请输入金额");
					return;
				}
				mny.hide();
				nowmny.show();
				o.text("修改");
				tmpmny = mny.val();
				nm.text(mny.val());
				$("#isneed").text(mny.val());
			}
		}
		var paytype = $(".paytype[checked=checked]");
		$("input[type=radio]").click(function(){
			paytype.attr("checked",false);
			paytype.prop("checked",false);
			$(this).attr("checked",true);
			$(this).prop("checked",true);
		});
		function gopay(){
			var pt = $(".paytype[checked=checked]");
			$.post(
				"/HPay/setmny",{"mny":$("#nm").text()},function(data){
					if(pt.attr("id")=="ali"){
						location.href = "/HPay/alipay";
					}else{
						location.href = "/HPay/wxpay";
					}
				}
			);
		}
	</script>
</html>
